#pragma once

#include <vector>
#include <jni.h>
#include "jstr.h"
#include "jtype.h"

namespace gtl
{

namespace jni
{

class jbools
{
public:
	jbools(JNIEnv* env, const bool* vals, int count)
	{
		m_env = env;
		m_vals = 0;
		if(vals == 0 || count <= 0)
			return;

		std::vector<jboolean> values;
		for(int i = 0; i < count; ++i)
		{
			values.push_back(vals[i]);
		}
		
		m_vals = m_env->NewBooleanArray(count);
		m_env->SetBooleanArrayRegion(m_vals, 0, count, &values[0]);
	}

	~jbools()
	{
	}

public:
	jbooleanArray vals()
	{
		return m_vals;
	}

	operator jbooleanArray()
	{
		return m_vals;
	}

protected:
	JNIEnv* m_env;
	jbooleanArray m_vals;
};

} // end of namespace jni

} // end of namespace gtl
